package com.cskaoyan.controller;

import com.cskaoyan.bean.BaseRespVo;
import com.cskaoyan.bean.keyword.KeywordCreateBO;
import com.cskaoyan.bean.param.BaseParam;
import com.cskaoyan.bean.po.MarketKeyword;
import com.cskaoyan.service.KeywordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author chenai
 * @description TODO
 * @date 2022-06-07 14:57
 */
@RestController
@RequestMapping("admin/keyword")
public class KeywordController {

    @Autowired
    KeywordService keywordService;

    //http://182.92.235.201:8083/admin/keyword/list?page=1&limit=20&keyword=23&url=123&sort=add_time&order=desc
    @RequestMapping("list")
    public BaseRespVo list(BaseParam baseParam, String keyword, String url) {
        return keywordService.list(baseParam, keyword, url);
    }

    @RequestMapping("create")
    public BaseRespVo create(@RequestBody() KeywordCreateBO keywordCreateBO) {
        return keywordService.create(keywordCreateBO);
    }

    @RequestMapping("update")
    public BaseRespVo update(@RequestBody() MarketKeyword marketKeyword) {
        return keywordService.update(marketKeyword);
    }

    @RequestMapping("delete")
    public BaseRespVo delete(@RequestBody MarketKeyword marketKeyword){
        return keywordService.delete(marketKeyword);
    }
}
